#ifndef _X_DEFER_H
#define _X_DEFER_H
#include <iostream>
#include <functional>
namespace base
{
    class x_defer{
        public:
            typedef std::function<void(void)> defer_func;
            x_defer(defer_func _func) : func(_func){}
            ~x_defer(){
                func();
            }
        private:
            defer_func func;
    };
}

#endif